#include <iostream>
// #include <fostream>

class VirtualNum
{
public:
    VirtualNum(int real,int vir)
    {
        this->real = real;
        this->vir = vir;
    }

    VirtualNum(const VirtualNum& a)
    {
        this->real = a.real;
        this->vir = a.vir;
    }
    VirtualNum operator+(const VirtualNum& b)
    {
        VirtualNum c(0,0);
        c.real = this->real + b.real;
        c.vir = this->vir + b.vir;
        return c;
    }
    VirtualNum operator-(const VirtualNum& b)
    {
        VirtualNum c(0,0);
        c.real = this->real - b.real;
        c.vir = this->vir - b.vir;
        return c;
    }
    friend std::ostream& operator<<(std::ostream &out,const VirtualNum& a);
private:
    int real;
    int vir;
};
std::ostream& operator<<(std::ostream &out,const VirtualNum& a)
{
    out<<a.real<<"+"<<a.vir<<"i"<<std::endl;
    return out;
}
int main()
{
    VirtualNum a(1,2);
    VirtualNum b(2,3);
    VirtualNum c = a+b+b;
    VirtualNum d = a-b-a;
    // c.Print();
    // d.Print();
    std::cout<<c;
    std::cout<<d;
    return 0;
}